package com.bitao.friend.controller.user;

import com.bitao.friend.aspect.CheckUserStatus;
import com.bitao.comstants.HttpConstants;
import com.bitao.controller.BaseController;
import com.bitao.R;
import com.bitao.TableDataInfo;
import com.bitao.friend.domain.exam.dto.ExamDTO;
import com.bitao.friend.domain.exam.dto.ExamQueryDTO;
import com.bitao.friend.service.user.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2025-06-06  10:43
 */
@RestController
@RequestMapping("/user/exam")
public class UserExamController extends BaseController {

    @Autowired
    private IUserExamService userExamService;

    @CheckUserStatus
    @PostMapping("/enter")
    public R<Void> enter(@RequestHeader(HttpConstants.AUTHENTICATION) String token, @RequestBody ExamDTO examDTO) {
        return toR(userExamService.enter(token, examDTO.getExamId())) ;
    }

    @GetMapping("/list")
    public TableDataInfo list(ExamQueryDTO examQueryDTO){
        return userExamService.list(examQueryDTO);
    }
}
